function countReducer(preState = 0, action) {
    console.log('count_reducer', preState, action);
    //拿到action中发送的类型 和 数据
    const {
        type,
        data
    } = action;

    switch (type) {
        case 'increment':
            return preState + data;
        case 'decrement':
            return preState - data;

        //如果条件都不符合 则返回一个初始状态值，这个初始状态值在函数默认值给过了
        default:
            return preState;
    }
}

export default countReducer;